package com.health.work.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class UserInfoUtils {
	
	public static String getUserProperty(Context mContext,String propertyName){
		if(mContext==null){
			return "UserInfoUtils 中的函数调用 第一个参数mContext为空！";
		}
		SharedPreferences pre =mContext.getSharedPreferences(HEALTHPASSPORT.USERINFO, 0);
		if(propertyName.equals(HEALTHPASSPORT.INTERGRAL)){
			return pre.getString(propertyName, "0");
		}
		if(propertyName.equals(HEALTHPASSPORT.MOBILEPHONE)){
			return pre.getString(propertyName, "");
		}
		if(propertyName.equals(HEALTHPASSPORT.IDNUMBER)){
			return pre.getString(propertyName, null);
		}
		return pre.getString(propertyName, "");
		
	}
	
	public static boolean isLogin(Context mContext){
		boolean flag=false;
		SharedPreferences pre =mContext.getSharedPreferences(HEALTHPASSPORT.USERINFO, 0);
		if(pre.getString(HEALTHPASSPORT.INTERGRAL, null)!=null &&!"".equals(pre.getString(HEALTHPASSPORT.INTERGRAL, null))){
			flag=true;
		}else{
			
		}
		return flag;
	}
	
	public static boolean passwordInvildet(String str){
		boolean flag=true;
		if(str!=null &&str.trim().length()>=4){
			for(int i=0;i<str.length()-1;i++){
				if(str.charAt(i)==str.charAt(i+1)){
					return false;
				}
			}
		}else{
			return false;
		}
		return flag;
	}

}
